import { http } from "@/utils/request";
import type { LinksResponse } from "./type";

// 获取链接列表
export const getLinksListApi = (page?: number, pageSize?: number) => {
  return http.get<LinksResponse>("/links", {
    params: {
      page,
      pageSize,
    },
  });
};

// 查询分类
export const searchLinksAPI = (title: string) => {
  return http.get(`/links/${title}/search`, {});
};

// 获取链接
export const getLinksAPI = (id: number) => {
  return http.get(`/links/${id}`, {});
};

// 搜索链接
export const searchLinks = (title: string) => {
  return http.get(`/links/${title}/search`, {
    params: {
      title,
    },
  });
};
